<?php

include_once './common.php';
if(!empty($_GET)){
	$phonenum=$_GET["phonenum"];
	$password=$_GET["password"];
	$sql = "SELECT * FROM study WHERE phonenum='$phonenum' AND password='$password'";
	$res = mysqli_query($link,$sql);
	$one = mysqli_fetch_assoc($res);
	$reslut = array();
	if(!empty($one)){
		// 数据库里用户名和密码吻合
		$reslut['status'] = 1;
		$reslut['info'] = "用户名正确";
		$reslut['res'] = $one;
			// echo "<script>alert('登录成功');window.location.href='./index.html'</script>";
			// echo "window.location.href='./index.html'";
	}else{
		// 没有用户名
		$reslut['status'] = 0;
		$reslut['info'] = "用户名错误";
		// echo "<script>alert('登录失败');</script>";
	}
	// var_dump($reslut);
	
	echo json_encode($reslut);
	
}

?>